package testes;

import static org.junit.Assert.*;


import java.util.HashSet;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.quasar.copaPaises.businessLayer.*;

public class ContinenteTest {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
	}

	@AfterClass
	public static void tearDownAfterClass() throws Exception {
	}

	@Before
	public void setUp() throws Exception {
		 CalendarDate.allInstances.clear();
		  Campeonato.allInstances.clear();
		  Cartao.allInstances.clear();
		  Cidade.allInstances.clear();
		  Clube.allInstances.clear();
		  Continente.allInstances.clear();
		  Equipa.allInstances.clear();
		  Estadio.allInstances.clear();
		  Golo.allInstances.clear();
		  Grupo.allInstances.clear();
		  Jogador.allInstances.clear();
		  Jogo.allInstances.clear();
		  Membro.allInstances.clear();
		  Pais.allInstances.clear();
		  Participacao.allInstances.clear();
		  Participante.allInstances().clear();
		  Treinador.allInstances.clear();
	}

	@After
	public void tearDown() throws Exception {
		 CalendarDate.allInstances.clear();
		  Campeonato.allInstances.clear();
		  Cartao.allInstances.clear();
		  Cidade.allInstances.clear();
		  Clube.allInstances.clear();
		  Continente.allInstances.clear();
		  Equipa.allInstances.clear();
		  Estadio.allInstances.clear();
		  Golo.allInstances.clear();
		  Grupo.allInstances.clear();
		  Jogador.allInstances.clear();
		  Jogo.allInstances.clear();
		  Membro.allInstances.clear();
		  Pais.allInstances.clear();
		  Participacao.allInstances.clear();
		  Participante.allInstances().clear();
		  Treinador.allInstances.clear();
	}

	@Test
	public final void testContinente() {
		Continente c = new Continente();
		assertNotNull(c);
	}

	@Test
	public final void testContinenteString() {
		Continente c = new Continente("Europa");
		assertNotNull(c);
	}

	@Test
	public final void testNome() {
		Continente c = new Continente("Europa");
		assertTrue(c.nome().equals("Europa"));
	}

	@Test
	public final void testSetNome() {
		Continente c = new Continente("Europa");
		c.setNome("Africa");
		assertTrue(c.nome().equals("Africa"));
	}

	@Test
	public final void testPaises() {
		Continente c = new Continente("Europa");
		Continente c2 = new Continente();
		c2.setNome("Africa");
		Pais p1 = new Pais();
		Pais p2 = new Pais();
		Pais p3 = new Pais();
		p1.setContinente(c);
		p2.setContinente(c);
		p3.setContinente(c2);
		assertTrue(c.paises().size()==2);
	}

	@Test
	public final void testSetPaises() {
		Pais p1 = new Pais();
		Pais p2 = new Pais();
		Pais p3 = new Pais();
		Continente c = new Continente("Europa");
		HashSet<Pais> p = new HashSet<Pais>();
		p.add(p1); p.add(p2); p.add(p3);
		c.setPaises(p);
		assertTrue(c.paises().equals(p));
		
	}


	@Test
	public final void testToString() {
		Continente c = new Continente("Europa");
		assertTrue(c.toString().equals("Continente [nome=Europa]\n"));
		
	}

}
